Make a NO_WINDOW widget, as it should have been since the beginning, but
authorOwen Taylor <otaylor@redhat.com>
Sun, 18 Nov 2001 23:33:21 +0000 (23:33 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Sun, 18 Nov 2001 23:33:21 +0000 (23:33 +0000)
Sun Nov 18 18:18:11 2001  Owen Taylor  <otaylor@redhat.com>

* gtk/gtkfixed.c: Make a NO_WINDOW widget, as it should
have been since the beginning, but as special hack,
allow clearing the NO_WINDOW flag to get a window widget.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
docs/Changes-2.0.txt
gtk/gtkfixed.c

index 85e4f40dcd6bcdb3ab8bc0e1561d2754fa40c68e..c5fd2f0f1c54a3f5b174ca36e0769272cbad6ae7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sun Nov 18 18:18:11 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkfixed.c: Make a NO_WINDOW widget, as it should
+       have been since the beginning, but as special hack,
+       allow clearing the NO_WINDOW flag to get a window widget.
+
 Sun Nov 18 22:01:36  Kristian Rietveld  <kristian@planet.nl>
 
        * gtk/gtktreestore.c: return TRUE when value changed, so
index 85e4f40dcd6bcdb3ab8bc0e1561d2754fa40c68e..c5fd2f0f1c54a3f5b174ca36e0769272cbad6ae7 100644 (file)
@@ -1,3 +1,9 @@
+Sun Nov 18 18:18:11 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkfixed.c: Make a NO_WINDOW widget, as it should
+       have been since the beginning, but as special hack,
+       allow clearing the NO_WINDOW flag to get a window widget.
+
 Sun Nov 18 22:01:36  Kristian Rietveld  <kristian@planet.nl>
 
        * gtk/gtktreestore.c: return TRUE when value changed, so
index 85e4f40dcd6bcdb3ab8bc0e1561d2754fa40c68e..c5fd2f0f1c54a3f5b174ca36e0769272cbad6ae7 100644 (file)
@@ -1,3 +1,9 @@
+Sun Nov 18 18:18:11 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkfixed.c: Make a NO_WINDOW widget, as it should
+       have been since the beginning, but as special hack,
+       allow clearing the NO_WINDOW flag to get a window widget.
+
 Sun Nov 18 22:01:36  Kristian Rietveld  <kristian@planet.nl>
 
        * gtk/gtktreestore.c: return TRUE when value changed, so
index 85e4f40dcd6bcdb3ab8bc0e1561d2754fa40c68e..c5fd2f0f1c54a3f5b174ca36e0769272cbad6ae7 100644 (file)
@@ -1,3 +1,9 @@
+Sun Nov 18 18:18:11 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkfixed.c: Make a NO_WINDOW widget, as it should
+       have been since the beginning, but as special hack,
+       allow clearing the NO_WINDOW flag to get a window widget.
+
 Sun Nov 18 22:01:36  Kristian Rietveld  <kristian@planet.nl>
 
        * gtk/gtktreestore.c: return TRUE when value changed, so
index 85e4f40dcd6bcdb3ab8bc0e1561d2754fa40c68e..c5fd2f0f1c54a3f5b174ca36e0769272cbad6ae7 100644 (file)
@@ -1,3 +1,9 @@
+Sun Nov 18 18:18:11 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkfixed.c: Make a NO_WINDOW widget, as it should
+       have been since the beginning, but as special hack,
+       allow clearing the NO_WINDOW flag to get a window widget.
+
 Sun Nov 18 22:01:36  Kristian Rietveld  <kristian@planet.nl>
 
        * gtk/gtktreestore.c: return TRUE when value changed, so
index 85e4f40dcd6bcdb3ab8bc0e1561d2754fa40c68e..c5fd2f0f1c54a3f5b174ca36e0769272cbad6ae7 100644 (file)
@@ -1,3 +1,9 @@
+Sun Nov 18 18:18:11 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkfixed.c: Make a NO_WINDOW widget, as it should
+       have been since the beginning, but as special hack,
+       allow clearing the NO_WINDOW flag to get a window widget.
+
 Sun Nov 18 22:01:36  Kristian Rietveld  <kristian@planet.nl>
 
        * gtk/gtktreestore.c: return TRUE when value changed, so
index 85e4f40dcd6bcdb3ab8bc0e1561d2754fa40c68e..c5fd2f0f1c54a3f5b174ca36e0769272cbad6ae7 100644 (file)
@@ -1,3 +1,9 @@
+Sun Nov 18 18:18:11 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkfixed.c: Make a NO_WINDOW widget, as it should
+       have been since the beginning, but as special hack,
+       allow clearing the NO_WINDOW flag to get a window widget.
+
 Sun Nov 18 22:01:36  Kristian Rietveld  <kristian@planet.nl>
 
        * gtk/gtktreestore.c: return TRUE when value changed, so
index 6e4222577e5f67fb0514c4bb6982ea637f3d91a1..1c8e8cfddd9020d3b7f4f7b42d2519e669eb2e43 100644 (file)
@@ -528,7 +528,15 @@ Incompatible Changes from GTK+-1.2 to GTK+-2.0:
      you must make sure you call gtk_container_propagate_expose()
      correctly, as you must for any NO_WINDOW widgets.
 
+  GtkFixed is a little special; it is now created by default as
+  a NO_WINDOW widget, but if you do 
+
+    GTK_WIDGET_UNSET_FLAGS (fixed, GTK_WIDGET_NO_WINDOW)
+
+  after creating a fixed widget, it will create a window and
+  handle it properly.
+
 * GtkLayout no longer has the xoffset, yoffset fields, which used
   to store the difference between world and window coordinates for
   layout->bin_window. These coordinate systems are now always
-  the same.
\ No newline at end of file
+  the same.
index 2295d286f60e94115077ecf5af0a8bf0ed6bc5a0..8f5dd6d4d00ebe416cb378a34ed54fe2d446a4bf 100644 (file)
@@ -144,7 +144,7 @@ gtk_fixed_child_type (GtkContainer     *container)
 static void
 gtk_fixed_init (GtkFixed *fixed)
 {
-  GTK_WIDGET_UNSET_FLAGS (fixed, GTK_NO_WINDOW);
+  GTK_WIDGET_SET_FLAGS (fixed, GTK_NO_WINDOW);
  
   fixed->children = NULL;
 }
@@ -311,27 +311,32 @@ gtk_fixed_realize (GtkWidget *widget)
 
   g_return_if_fail (GTK_IS_FIXED (widget));
 
-  GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
-  attributes.window_type = GDK_WINDOW_CHILD;
-  attributes.x = widget->allocation.x;
-  attributes.y = widget->allocation.y;
-  attributes.width = widget->allocation.width;
-  attributes.height = widget->allocation.height;
-  attributes.wclass = GDK_INPUT_OUTPUT;
-  attributes.visual = gtk_widget_get_visual (widget);
-  attributes.colormap = gtk_widget_get_colormap (widget);
-  attributes.event_mask = gtk_widget_get_events (widget);
-  attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK;
-
-  attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, 
-                                  attributes_mask);
-  gdk_window_set_user_data (widget->window, widget);
-
-  widget->style = gtk_style_attach (widget->style, widget->window);
-  gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
+  if (GTK_WIDGET_NO_WINDOW (widget))
+    GTK_WIDGET_CLASS (parent_class)->realize (widget);
+  else
+    {
+      GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+
+      attributes.window_type = GDK_WINDOW_CHILD;
+      attributes.x = widget->allocation.x;
+      attributes.y = widget->allocation.y;
+      attributes.width = widget->allocation.width;
+      attributes.height = widget->allocation.height;
+      attributes.wclass = GDK_INPUT_OUTPUT;
+      attributes.visual = gtk_widget_get_visual (widget);
+      attributes.colormap = gtk_widget_get_colormap (widget);
+      attributes.event_mask = gtk_widget_get_events (widget);
+      attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK;
+      
+      attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+      
+      widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, 
+                                      attributes_mask);
+      gdk_window_set_user_data (widget->window, widget);
+      
+      widget->style = gtk_style_attach (widget->style, widget->window);
+      gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
+    }
 }
 
 static void
@@ -390,13 +395,17 @@ gtk_fixed_size_allocate (GtkWidget     *widget,
   fixed = GTK_FIXED (widget);
 
   widget->allocation = *allocation;
-  if (GTK_WIDGET_REALIZED (widget))
-    gdk_window_move_resize (widget->window,
-                           allocation->x, 
-                           allocation->y,
-                           allocation->width, 
-                           allocation->height);
 
+  if (!GTK_WIDGET_NO_WINDOW (widget))
+    {
+      if (GTK_WIDGET_REALIZED (widget))
+       gdk_window_move_resize (widget->window,
+                               allocation->x, 
+                               allocation->y,
+                               allocation->width, 
+                               allocation->height);
+    }
+      
   border_width = GTK_CONTAINER (fixed)->border_width;
   
   children = fixed->children;
@@ -410,6 +419,13 @@ gtk_fixed_size_allocate (GtkWidget     *widget,
          gtk_widget_get_child_requisition (child->widget, &child_requisition);
          child_allocation.x = child->x + border_width;
          child_allocation.y = child->y + border_width;
+
+         if (GTK_WIDGET_NO_WINDOW (widget))
+           {
+             child_allocation.x += widget->allocation.x;
+             child_allocation.y += widget->allocation.y;
+           }
+         
          child_allocation.width = child_requisition.width;
          child_allocation.height = child_requisition.height;
          gtk_widget_size_allocate (child->widget, &child_allocation);